<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>見積管理</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>

		<script src="assets/scripts/ui/jquery-ui-1.7.2.custom.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript">
		$(function() {
		
			// メッセージのフェード
			$('.message').fadeIn("slow");

		});
		</script>
		
		<!--タイムコントロール -->
		<script>
		$(document).ready(function(){ 
			$("#r_date1").wrDate();  
			$("#r_date2").wrDate();  
			$("#u_date1").wrDate();  
			$("#u_date2").wrDate();  
		});

		$.extend({ 
			wrDate : function(objs) { 
			objs.each(function(i) { 
				//jQueryオブジェクトをトラバース
				var inputObj = $(this); 
				inputObj.datepicker({
					changeMonth: true,
					changeYear: true,
					dateFormat: 'yy/mm/dd'
				}); //各jQueryオブジェクトにCalendarコントロール
			}); 
		}});

		$.fn.extend({ 
			wrDate : function() { 
			//wrDate jQueryプラグインの名前を定義します
			$.wrDate(this); //呼び出す前に、カスタムjQuery関数 
		}});
		
		</script>	
		
		
		
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />

		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
		<script type="text/javascript">
			var sorter = new TINY.table.sorter("sorter");
				sorter.head = "head";
				sorter.asc = "asc";
				sorter.desc = "desc";
				sorter.even = "evenrow";
				sorter.odd = "oddrow";
				sorter.evensel = "evenselected";
				sorter.oddsel = "oddselected";
				sorter.paginate = true;
				sorter.currentid = "currentpage";
				sorter.limitid = "pagelimit";
			$(function(){
					sorter.init("inquiry_result",0);
			});
		</script>

		
	</head>
	<body id="" >
{{ php }} include( MENU_FILE ); {{ /php }}

		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>
		<div id="container"><div class="wrapper">

			<h2>見積管理</h2>
			<ul class="submenu clearfix">
				<li>顧客検索</li>								
				<li><a href="consumer_form.php">顧客登録</a></li>
				<li><a href="price_task.php">見積タスク一覧</a></li>
				<li><a href="price_check.php">見積検索</a></li>
				<li><a href="shop_index.php">商品マスタ</a></li>
			</ul>
			
			<h3>顧客検索</h3>
					
			
			<p class="message">条件を入力し、検索ボタンをクリックしてください。</p>
			<form action="consumer_index.php" method="get">
			<table id="inquiry_result" class="formTable">
				<thead>
					<tr>
						<th>会社名</th>
						<td><input type="text" name="company_name" id="text_information" class="text" value="{{ $forms.company_name }}" /></td>
					</tr>
					<tr>
						<th>会社（カタカナ）</th>
						<td><input type="text" name="katakana" id="text_information" class="text" value="{{ $forms.katakana }}" /></td>
					</tr>
					<tr>
						<th>支店名</th>
						<td><input type="text" name="branch_name" id="text_information" class="text" value="{{ $forms.branch_name }}" /></td>
					</tr>
					<tr>
						<th>セールス担当者</th>
						<td><input type="text" name="sal_manager" id="text_information" class="text" value="{{ $forms.sal_manager }}" /></td>
					</tr>
					<tr>
						<th>登録日</th>
						<td><input type="text" id="r_date1"  name="r_date1" style="width: 100px" value="{{ $forms.r_date1 }}" class="text" />&nbsp;～&nbsp;<input type="text" id="r_date2" name="r_date2" style="width: 100px" value="{{ $forms.r_date2 }}" class="text" /></td>
					</tr>
					<tr>
						<th>更新日</th>
						<td><input type="text" id="u_date1" name="u_date1" style="width: 100px" value="{{ $forms.u_date1 }}" class="text" />&nbsp;～&nbsp;<input type="text" id="u_date2" name="u_date2" style="width: 100px" value="{{ $forms.u_date2 }}" class="text" /></td>
					</tr>
				</thead>			
			</table>
					
			<p class="button">
				<button type="submit" id="btn_search" class="submit"><span>検索</span></button>
			</p>
			</form><br/>
			
			<p class="message"><span style="color: red">{{$cnt}}</span>件登録されています</p>
			
			{{ if $cnt > 0 }}
			<h2>検索結果</h2>
			<form name="form1" action="consumer_csv.php" method="post">
			<input type="hidden" name="company_name" value="{{ $forms.company_name }}" />
			<input type="hidden" name="katakana" value="{{ $forms.katakana }}" />
			<input type="hidden" name="branch_name" value="{{ $forms.branch_name }}" />
			<input type="hidden" name="sal_manager" value="{{ $forms.sal_manager }}" />
			<input type="hidden" name="r_date1" value="{{ $forms.r_date1 }}" />
			<input type="hidden" name="r_date2" value="{{ $forms.r_date2 }}" />
			<input type="hidden" name="u_date1" value="{{ $forms.u_date1 }}" />
			<input type="hidden" name="u_date2" value="{{ $forms.u_date2 }}" />
			<input type="hidden" name="page" value="{{ $page.current }}" />
			
			<table id="inquiry_result" class="formTable">
				<thead>
					<tr align="center">
						<th>会社名</th>
						<th>支店名</th>
						<th>セールス担当者</th>
						<th>支払条件</th>
						<th>登録日</th>
						<th>更新日</th>
						<th>参照</th>
						<th>単価リスト</th>
					</tr>

				</thead>
				<tbody>
					
{{ foreach from=$consumerlist key=k item=v }}
					<tr>
						<td>{{ $v.company_name }}</td>
						<td>{{ $v.branch_name }}</td>
						<td>{{ $v.sal_manager }}</td>
						<td>{{ $v.payment_term }}</td>
						<td align="center">{{ $v.r_date }}</td>
						<td align="center">{{ $v.u_date }}</td>
						<td align="center"><a href="consumerInfo.php?consumer_id={{ $v.consumer_id }}">[参照]</a></td>
						<td align="center"><a href='consumer_price.php?consumer_id={{ $v.consumer_id }}'>[単価リスト]</a></td>
					</tr>
{{ /foreach }}				
				</tbody>
			</table>
			
			<p align="center">
{{ if $page.current > 1 }}
				<a href="consumer_index.php?page={{ $page.current-1 }}{{ $page.query }}">前の{{ $page.item }}件</a>&nbsp;&nbsp;
{{ /if }}
{{ foreach from=$page.paging key=k item=v }}
{{ if $v < $page.current+15 }}
{{ if $page.current == $v }}
{{ $v }}&nbsp;
{{ else }}
				<a href="consumer_index.php?page={{ $v }}{{ $page.query }}">{{ $v }}</a>&nbsp;
{{ /if }}
{{ /if }}
{{ /foreach }}
{{ if $page.end > $page.current }}
				<a href="consumer_index.php?page={{ $page.current+1 }}{{ $page.query }}">次の{{ $page.item }}件</a>
{{ /if }}
			</p>			
			
			<p class="button">
				<button type="submit" id="btn_csv" class="submit"><span>CSV出力</span></button>
			</p>
		</form>
{{ /if }}
		</div></div>
			
			
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>

	</body>
</html>